﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Dijiang.Values
{
    public class DSymbol : DValue
    {
        public bool quoted;
        public string sym;

        public DSymbol(string sym, bool quoted = false)
        {
            this.sym = sym;
            this.quoted = quoted;
        }

        public virtual DValue Eval(CmdEnv env)
        {
            return quoted ? this : env.Get(sym);
        }

        public DValue Copy()
        {
            return new DSymbol(sym);
        }

        public override string ToString()
        {
            return $"<Symbol,{sym}>";
        }

        public bool Equals(DValue? other)
        {
            return other is DSymbol so && sym == so.sym;
        }
    }
}
